﻿using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.ZHLC;
using NP.BPMReportPlatform.ZHLC.Dto;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.ZHLC
{
    /// <summary>
    /// 召回流程 接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/zhlc")]
    public class ZHLCController : BPMReportPlatformController
    {
        private readonly IZHLCService _zHLCService;

        public ZHLCController(IZHLCService zHLCService)
        {
            _zHLCService = zHLCService;
        }

        /// <summary>
        ///召回流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("GetAllAsync")]
        public async Task<PagedResultDto<GetZHLCOutput>> GetAllAsync([FromBody] GetZHLCInput input)
        {
            return await _zHLCService.GetAllAsync(input);
        }

        /// <summary>
        /// 召回流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("ExportAsync")]
        public async Task<XlsxFileResult<GetZHLCOutput>> ExportAsync([FromBody] GetZHLCInput input)
        {
            var rst = await _zHLCService.ExportAsync(input);
            return new XlsxFileResult<GetZHLCOutput>(rst, "导出Excel");
        }
    }
}